/******************************************************************************
 * The contents of this file are subject to the   JDI License  Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * Software distributed under the License is distributed on an  "AS IS"  basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 * The Initial Developer of the Original Code is 陈慧然. Portions created by 
 * 陈慧然 are Copyright 陈慧然.
 * All Rights Reserved.
 *
 *              Contact john_holen@163.com for licensing alternatives.
 *
 *****************************************************************************/


package org.peony.standard.db;

import org.peony.tools.PeonyLogger;

/**
 *  
 *
 *  @author     陈慧然
 *  @version    Id: SAConnectionProviderFactory.java, v 0.000 2008-7-8 下午02:22:37 陈慧然 Exp
 */
public abstract class SAJDBCConnectionProviderFactory{
	
	/**
	 * 获得JDBC连接生产器工厂实例
	 * @param className
	 * @return
	 */
	public static SAJDBCConnectionProviderFactory getConnectionProviderFactory(String className){
		PeonyLogger logger = PeonyLogger.getInstance();
		logger.info("正在初始化 JDBC连接生成器工厂：" + className);
		try{
			Class clazz = Class.forName(className); 
			SAJDBCConnectionProviderFactory factory = (SAJDBCConnectionProviderFactory)clazz.newInstance(); 
			logger.info("完成初始化 JDBC连接生成器工厂：" + className);
			return factory;
		}catch (Exception e) {
			throw new RuntimeException(e);
		}
	}
	/**
	 * 获得JDBC连接生产器实例
	 * @return
	 */
	public abstract SIJDBCConnectionProvider getConnectionProvider();
}
